package com.crazyhat.crazyhat.utils;

/**
 * ThreadLocal工具类
 */
@SuppressWarnings("all")
public class ThreadLocalUtil {
    
    /**
     * ThreadLocal对象
     */
    private static final ThreadLocal THREAD_LOCAL = new ThreadLocal();

    /**
     * 根据键名获取数据
     * @param <T>
     * @return
     */
    public static <T> T get(){
        return (T) THREAD_LOCAL.get();
    }
	
    /**
     * 存储键值对
     * @param value
     */
    public static void set(Object value){
        THREAD_LOCAL.set(value);
    }


    /**
     * 清除ThreadLocal,防止内存泄漏
     */
    public static void remove(){
        THREAD_LOCAL.remove();
    }


}
